package ae.pcfc.cldos.online.common.facade.provider;

import java.util.ArrayList;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import ae.pcfc.cldos.online.common.facade.BaseFacade;
import ae.pcfc.cldos.online.common.facade.EmirateCityFacade;
import ae.pcfc.cldos.online.common.tscdb.domain.TTscEmirateCity;
import ae.pcfc.cldos.online.common.tscdb.domain.manager.TTscEmirateCityDOM;
import ae.pcfc.cldos.online.common.vo.selectors.EmirateCityVO;


/**
 * Emirate City Facade Implementation for getting a list of emirate cities against the emirate code
 * @author ammar
 *
 */
public class EmirateCityFacadeImpl extends BaseFacade implements EmirateCityFacade {
	
	private TTscEmirateCityDOM tTscEmirateCityDOM;
	
	public void setTTscEmirateCityDOM(TTscEmirateCityDOM tTscEmirateCityDOM) {
		this.tTscEmirateCityDOM = tTscEmirateCityDOM;
	}
	@Transactional
	public List<EmirateCityVO> getEmirateCitiesByEmirateCode(String emirateCode) {
		List<TTscEmirateCity> emirateCitiesList = tTscEmirateCityDOM.getEmirateCityByEmirateCode(emirateCode);
		List<EmirateCityVO> result = new ArrayList<EmirateCityVO>(10);
		for(TTscEmirateCity emirateCity : emirateCitiesList){
			EmirateCityVO emirateCityVO = new EmirateCityVO();
			getMapper().map(emirateCity, emirateCityVO);
			result.add(emirateCityVO);
		}
		return result;
	}

}
